﻿//初始化
if (typeof ($) != "undefined") {
    $(document).ready(function () {
        //alert("postid:" + getPar1("PostID"))
        var postID = getPar1("postID");
        var postName = getPar1("postName");
        $("#PostID").val(postID)
        $("#PostName").val(postName);
        GetPostNotes(postID);

        //获取提报人employeeId
        YAHOO.util.Connect.asyncRequest('POST', "../EHR/GetCurrentUser.aspx", {
            success: function (res) {
                try {
                    var str = res.responseText;
                    if (str != "-1") {
                        var token = str.split('_');
                        instance[0].AddUser = token[0];
                    }
                }
                catch (e) {
                }
                finally {

                }
            },
            failure: function (error) {
                alert("数据错误：" + error.statusText);
            }
        }, null);
    });
    instance[0].AddTime = new Date();
}

//获取岗位说明
function GetPostNotes(postID) {
    var url = "../Extend/AjaxData/jsonlist.aspx?entity=hrPostHumanEstablishment&condition=PostID='" + postID + "'";
    $.get(url, function (d, s) {
        var list = eval("(" + d + ")");
        for (var o in list.rows) {
            //debugger;
            var t = list.rows[o].EmpCount;
            if (typeof (t) != "undefined") {
                $("#EmpCount").val(t);
                $("#EffectDate").val(list.rows[o].EffectDate);
            }
        }
    });
}


var fnCheckData = function () {
    try {
        var reg = /^\d+(\.\d+)?$/;
        if (reg.test($("#EmpCount").val()) == false) {
            return "【编制】需要输入非零数字!";
        }
    }
    catch (e)
     { }
 }
